exports.searchApiDocsMenu = function (req, res) {

    //获取restful参数
    var restfulParams = req.routeInfo.restfulParams;

    var resultData = {};

    //任务流创建
    async.waterfall([

        //查询接口分类
        (cb) => {

            //判断是否需要带系统操作接口,0-带系统接口 1-不带系统接口
            var cType = "";
            if(restfulParams.type == 0){
                cType = "/or/apc_type-0,1"
            }else{
                cType = "/apc_type/0"
            }

            R.SEND_HTTP(
                req,
                res,
                {
                    url: CORE_APIConfig.coreAPI.menuActionPermissionsCategorySearch.Request_Api_Url + cType + "/skip/0/limit/1000",
                    method : 'GET'
                },
                function (data) {

                    resultData.categoryArr = data.result.data;
                    
                    cb();
                    
                }
            )

        },

        //查询每个分类下的操作接口
        (cb) => {

            var tasks = [];

            resultData.categoryArr.forEach((item) => {

                tasks.push((callback) => {

                    R.SEND_HTTP(
                        req,
                        res,
                        {
                            url: CORE_APIConfig.coreAPI.actionPermissionsSearch.Request_Api_Url + "/ap_apcid/"+ item.apc_id +"/ap_is_control/1/skip/0/limit/1000",
                            method : 'POST',
                            data : {
                                fields : "ap_id,ap_apcid,ap_api,ap_name,ap_desc"
                            }
                        },
                        function (data) {

                            item.apiList = data.result.data;
                            item.isShow  = false;
                            
                            callback();
                            
                        }
                    )
                })

            })

            async.parallel(tasks, cb);

        }

    ],()=> {

        //返回最终拼接结果
        RES.successResponse(res,resultData);

    });

}